<?php
/**
 * @ClassName: RebateEnum
 * @Description: 分成模式枚举
 * @author: gydtrade
 * @Date: 2025-09-27 00:02
 * @Version: V1.0.0
 */

namespace app\common\enum;

class RebateEnum
{
    //分成模式，1固定金额，2占比
    const methods_money = 1;
    const methods_prif = 2;

    //利润来源，1销售价-成本，2商品佣金
    const commission_from_sale = 1;
    const commission_from_commission = 2;

    //分成类型
    const divide_type_store_cost = 'storeCost';
    const divide_type_company_award = 'companyAward';


    /**
     * 分成模式，1固定金额，2占比
     * @param $level
     * @return string|string[]
     */
    public static function rebateTypeText($level)
    {
        $desc = [
            RebateEnum::methods_money => '固定金额',
            RebateEnum::methods_prif => '占比',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

    /**
     * 利润来源，1销售价-成本，2商品佣金
     * @param $level
     * @return string|string[]
     */
    public static function commissionFromText($level)
    {
        $desc = [
            RebateEnum::commission_from_sale => '销售价-溢价-成本',
            RebateEnum::commission_from_commission => '商品佣金',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }
    public static function divideTypeText($level)
    {
        $desc = [
            RebateEnum::divide_type_store_cost => '商家成本',
            RebateEnum::divide_type_company_award => '平台收益',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

}